package com.libertyville.adapter.driven.persistence.orgmng;

import com.libertyville.domain.orgmng.Org;
import com.libertyville.domain.orgmng.OrgRepository;
import org.springframework.stereotype.Repository;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Repository
public class OrgRepositoryImpl implements OrgRepository {
    @PersistenceContext
    private EntityManager entityManager;

    @Override
    public Org saveOrg(Org org) {
        entityManager.persist(org);
        return org;
    }

    @Override
    public Org findById(Integer orgId) {
        return entityManager.find(Org.class, orgId);
    }
}
